home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d3
/
rettig.arc
/
TRSOURCE.EXE
/
TR_NTXSZ.PRG
< prev
next >
Wrap
Text File
|
1990-10-22
|
833b
|
30 lines
*********
* TR_NTXSZ.PRG
*
* by Tom Rettig and Leonard Zerman
*
* Placed in the public domain by Tom Rettig Associates, 10/22/1990.
*
* Syntax: NTXSIZE( <key length>, <expN> )
* Return: <expN> integer maximum potential number of bytes in index file
*********
FUNCTION NTXSIZE
*
PARAMETERS keylen, last_recno
IF last_recno == 0
RETURN 2048 && size of empty ntx file, any key size
ELSE
RETURN ( INT(last_recno/INT(((1020/(keylen+10))-1)/2))+1 ) * 1024
ENDIF
* return statement is based on this algorithm:
* maxitem = 1020 / (keylen+10) && max items per node
* minkeys = int( (maxitem-1) / 2 ) && min keys per node
* knodes = int( last_recno / minkeys ) && kbytes of nodes
* return (knodes+1) * 1024 && add one for the header
* eofunc ntxsize